<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/jquery.easyui.min.js"></script>
    <script src="../js/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" href="../themes/icon.css">
    <link rel="stylesheet" href="../themes/default/easyui.css">
    <link rel="stylesheet" href="../css/wu.css">
    <script>
        $(function(){
            $("#productList").datagrid({
                fit:true,
                url:'../data/products.json',
                rownumbers:true,
                columns:[[
                    {field:'ck',checkbox:true},
                    {field:'code',title:'Code',width:100},
                    {field:'name',title:'Name',width:100},
                    {field:'price',title:'Price',width:100,align:'right'}
                ]],
                toolbar:'#wu_toolbar',
            });
            
            
        });
        function addProduct() {
            parent.addTabs("添加产品","goods/add_goods.html");
        }
        function reload() {
            $("#productList").datagrid('reload');
        }
        function del() {
            var rows=$("#productList").datagrid('getSelections');
            if(rows.length==0){
                $.messager.alert('消息',"请选择记录");
                return
            }
            $.messager.confirm('确认','您确认想要删除记录吗？',function(r){
                if (r){
                        var ids=""
                        for( var  i=0;i<rows.length;i++){
                            ids+=rows[i].code+" ";
                        }
                        $.messager.alert('消息',ids+" 删除成功！");
                }
            });

        }
    </script>

</head>
<body>
    <div id="wu_toolbar">
        <div class="wu_toolbar_button">
            <a  href="#" onclick="addProduct()" class="easyui-linkbutton" data-options="iconCls:'icon-add'" plain="true">添加</a>
            <a  href="#" onclick="del()" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" plain="true">删除</a>
            <a  href="#" onclick="reload()" class="easyui-linkbutton" data-options="iconCls:'icon-page-refresh'" plain="true">刷新</a>
            <a  href="#" class="easyui-linkbutton" data-options="iconCls:'icon-redo'" plain="true">撤销</a>
            <a  href="#" class="easyui-linkbutton" data-options="iconCls:'icon-help'" plain="true">帮助</a>
            <a  href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" plain="true">更新</a>
        </div>
        <div class="wu-toolbar-search">
            <label>起始时间:</label><input class="easyui-datebox" type="text" style="width:120px;height: 25px">
            <label>结束时间:</label><input class="easyui-datebox" type="text" style="width:120px;height: 25px">
            <a  href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a>
        </div>
    </div>
    <div id="productList" class="easyui-datagrid">

    </div>
</body>
</html>